#ifndef RSIM_VECT4_H
#define RSIM_VECT4_H

/* --------------------------------------------------------------------------*
* File: Vect4.h                                                              *
* Authors: Kishor Bhalerao                                                   *
* Email : kishor8dm@gmail.com                                                *
* Contributors:                                                              *
* Email:                                                                     *
* copyright (c) 2010 Authors.                                                *
*                                                                            *
* This program is free software: you can redistribute it and/or modify it    *
* under the terms of the GNU General Public License as published by the Free *
* Software Foundation, either version 3 of the License, or any later version.*
*                                                                            *
* This program is distributed in the hope that it will be useful, but        *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   *
* for more details. (http://www.gnu.org/licenses/)                           *
* -------------------------------------------------------------------------- */

#include "Vector.h"
#include <cstdlib>

namespace RSIM{

template <class T>
class Vect4_:public Vector_<T>{
	public:
		/** Allocate space */
		Vect4_();
		
		/** set each value to val */
		explicit Vect4_(const T& val);
		
		/** Specify each element explicitly */
		Vect4_(const T& val1, const T& val2, const T& val3, const T& val4);

		/** Copy constructor */
		Vect4_(const Vect4_<T>&);
		
		/** Copy constructor */
		Vect4_(const Matrix_<T>&);
		
		/** Copy constructor */
		Vect4_(const Vector_<T>&);
};

////////////////////////////////////////////////////////////////////////
template <class T>
inline Vect4_<T>::Vect4_(const Vect4_<T>& V):Vector_<T>(4){
	const T *ptr = V.Ptr();
	this->data_[0]=ptr[0];
	this->data_[1]=ptr[1];
	this->data_[2]=ptr[2];
	this->data_[3]=ptr[3];
	this->isColVec_ = V.isColVector();
}

////////////////////////////////////////////////////////////////////////
template <class T>
inline Vect4_<T>::Vect4_(const Matrix_<T>& M):Vector_<T>(4){
	if(M.getNElements()!=4){
		cout<<"\nDimension mismatch: From Vect4_::Vect4_(const Matrix& M). Exiting...\n";
		exit(0);
	}
	const T *ptr = M.Ptr();
	this->data_[0]=ptr[0];
	this->data_[1]=ptr[1];
	this->data_[2]=ptr[2];
	this->data_[3]=ptr[3];
	this->isColVec_ = (M.getNCol()==1);
}

////////////////////////////////////////////////////////////////////////
template <class T>
inline Vect4_<T>::Vect4_(const Vector_<T>& V):Vector_<T>(4){
	const T *ptr = V.Ptr();
	this->data_[0]=ptr[0];
	this->data_[1]=ptr[1];
	this->data_[2]=ptr[2];
	this->data_[3]=ptr[3];
	this->isColVec_ = V.isColVector();
}

template <class T>
inline Vect4_<T>::Vect4_():Vector_<T>(4){}

template <class T>
inline Vect4_<T>::Vect4_(const T& val):Vector_<T>(4,val){}

template <class T>
inline Vect4_<T>::Vect4_(const T& val1, const T& val2, const T& val3, const T& val4):Vector_<T>(4){ 
	this->data_[0]=val1;this->data_[1]=val2;this->data_[2]=val3;this->data_[3]=val4;
}

} // namespace RSIM

#endif